Skip to content

Fix importing X archive#365

Merged
SaptakS merged 12 commits intomainfrom
364-x-archives
Jan 13, 2025
Merged

Fix importing X archive#365
SaptakS merged 12 commits intomainfrom
364-x-archives

Conversation

@micahflee
Copy link
Member

@micahflee micahflee commented Jan 9, 2025

Fixes #364

As described in the issue, it turns out if the user download their X archive from Safari on a Mac, Safari will automatically unzip it. If they try zipping it up again, the resulting zip file will have the archive in a nested folder, which Cyd isn't looking for.

This PR fixes it by allowing the user to select either the zip file or the already-unzipped folder. It refactors the IPC functions showSelectZIPFileDialog and showSelectFolderDialog into a single function, showOpenDialog, with settings to allow for selecting folders, selecting files, and filtering files.

… path, and make it alert those files when importing an X archive
… archive path, and make it alert those files when importing an X archive"

This reverts commit 0a36a15.
…alog into a single function, showOpenDialog, with settings to allow for selecting folders, selecting files, and filtering files.

Make the two places that used these functions (advanced settings modal, and importing X archive) use the new function.

When importing the X archive, if the path selected is not a ZIP file, treat it like an already unzipped folder.
@micahflee micahflee changed the title WIP fix importing X archive Fix importing X archive Jan 13, 2025
@micahflee micahflee marked this pull request as ready for review January 13, 2025 00:06
@micahflee micahflee requested a review from SaptakS January 13, 2025 00:07
Copy link
Contributor

@SaptakS SaptakS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file and folder selector together doesn't work in linux (I tested) and windows. Left some inline comments regarding the same.

} catch (error) {
throw new Error(packageExceptionForReport(error as Error));
if (selectFiles) {
properties.push('openFile');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had actually tried implementing the first time I was implementing this feature, but found out that this doesn't work with Windows and Linux.

From the docs:

Note: On Windows and Linux an open dialog can not be both a file selector and a directory selector, so if you set properties to ['openFile', 'openDirectory'] on these platforms, a directory selector will be shown.

So basically when I test it in Linux, that selector is just a folder selector, and I can't select zip files. I think the solution might be to give 2 different selectors (which I know looks terrible, but I don't know a way around).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eeek. I only tested in macOS. Okay, I'll make changes.

@micahflee micahflee requested a review from SaptakS January 13, 2025 17:32
@SaptakS SaptakS merged commit 238130d into main Jan 13, 2025
1 check passed
@SaptakS SaptakS deleted the 364-x-archives branch January 13, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problems importing X archive

2 participants